package com.itedge.solutionmanager.web.taskhandler.impl.solution;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;

import com.itedge.solutionmanager.domain.impl.Solution;
import com.itedge.infrastructure.service.process.IProcessService;
import com.itedge.infrastructure.service.task.ITaskService;
import com.itedge.infrastructure.service.taskdata.ITaskDataEntityService;
import com.itedge.infrastructure.stereotype.WebHandler;
import com.itedge.solutionmanager.taskdata.impl.solution.SolutionDeliveryTaskData;
import com.itedge.solutionmanager.web.convert.ISOFormattingConversionServiceBean;
import com.itedge.infrastructure.web.taskhandler.TaskHandlerException;
import com.itedge.infrastructure.web.taskhandler.TaskHandlerUtil;
import com.itedge.infrastructure.web.taskhandler.impl.AbstractTaskDataHandler;

@WebHandler
public class SolutionDeliveryTaskDataHandler extends AbstractTaskDataHandler<SolutionDeliveryTaskData, Solution> {

	@Autowired
    protected SolutionDeliveryTaskDataHandler(ISOFormattingConversionServiceBean conversionService,
    		IProcessService<Solution> solutionProcessService,
    		ITaskDataEntityService<SolutionDeliveryTaskData> solutionDeliveryTaskDataService,
    		ITaskService<SolutionDeliveryTaskData, Solution> solutionDeliveryTaskService,
			MessageSource messageSource) {
		super(conversionService, solutionProcessService, solutionDeliveryTaskDataService, 
				solutionDeliveryTaskService, messageSource);
	}
	
	@Override
	protected Class<SolutionDeliveryTaskData> getTaskDataClass() {
		return SolutionDeliveryTaskData.class;
	}
    
	@Override
	public Map<String,Object> loadTaskData(String taskId, Solution linkedSolution, Boolean forHistory) 
			throws TaskHandlerException {
		Map<String,Object> data = super.loadTaskData(taskId, linkedSolution, forHistory);
    	TaskHandlerUtil.applyDateTimePattern(data);
    	return data;
	}
	
}
